home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / tcl / tcl70b2.lha / tcl7.0b2 / compat / tmpnam.c < prev    next >
C/C++ Source or Header  |  1993-06-02  |  920b  |  36 lines

  1. /*
  2.  * Copyright (c) 1988 Regents of the University of California.
  3.  * All rights reserved.
  4.  *
  5.  * Redistribution and use in source and binary forms are permitted
  6.  * provided that this notice is preserved and that due credit is given
  7.  * to the University of California at Berkeley. The name of the University
  8.  * may not be used to endorse or promote products derived from this
  9.  * software without specific written prior permission. This software
  10.  * is provided ``as is'' without express or implied warranty.
  11.  */
  12.  
  13. #if defined(LIBC_SCCS) && !defined(lint)
  14. static char sccsid[] = "@(#)tmpnam.c    4.4 (Berkeley) 6/8/88";
  15. #endif /* LIBC_SCCS and not lint */
  16.  
  17. #include <sys/param.h>
  18. #include <sys/stat.h>
  19. #include <sys/file.h>
  20. #include <stdio.h>
  21.  
  22. #define    P_tmpdir    "/usr/tmp"
  23.  
  24. char *
  25. tmpnam(s)
  26.     char *s;
  27. {
  28.     static char name[50];
  29.     char *mktemp();
  30.  
  31.     if (!s)
  32.         s = name;
  33.     (void)sprintf(s, "%s/XXXXXX", P_tmpdir);
  34.     return(mktemp(s));
  35. }
  36.